/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alvaro
 */
@Entity
@Table(name = "user_configuration")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserConfiguration.findAll", query = "SELECT u FROM UserConfiguration u"),
    @NamedQuery(name = "UserConfiguration.findByIdUserConfiguration", query = "SELECT u FROM UserConfiguration u WHERE u.idUserConfiguration = :idUserConfiguration")})
public class UserConfiguration implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_USER_CONFIGURATION")
    private Integer idUserConfiguration;
    @JoinColumn(name = "USER", referencedColumnName = "ID_USER")
    @ManyToOne(optional = false)
    private User user;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "ID_LANGUAGE")
    @ManyToOne(optional = false)
    private Language language;

    public UserConfiguration() {
    }

    public UserConfiguration(Integer idUserConfiguration) {
        this.idUserConfiguration = idUserConfiguration;
    }

    public Integer getIdUserConfiguration() {
        return idUserConfiguration;
    }

    public void setIdUserConfiguration(Integer idUserConfiguration) {
        this.idUserConfiguration = idUserConfiguration;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUserConfiguration != null ? idUserConfiguration.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserConfiguration)) {
            return false;
        }
        UserConfiguration other = (UserConfiguration) object;
        if ((this.idUserConfiguration == null && other.idUserConfiguration != null) || (this.idUserConfiguration != null && !this.idUserConfiguration.equals(other.idUserConfiguration))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.UserConfiguration[ idUserConfiguration=" + idUserConfiguration + " ]";
    }
    
}
